/**
 * 
 */
package myTeam.timeShop.util;

import org.apache.shiro.crypto.hash.DefaultHashService;
import org.apache.shiro.crypto.hash.HashRequest;
import org.apache.shiro.crypto.hash.HashRequest.Builder;
import org.apache.shiro.util.ByteSource;

/**
 * @author jiangjintai
 * MD5生成工具，通过调用shiro的hashService生成一个字符串的五次hash值
 */
public class MyMD5Util {
	static DefaultHashService hashService = new DefaultHashService();
	static Builder builder = new HashRequest.Builder().setAlgorithmName("MD5").setIterations(5);;
	public static String toMD5String(String string){

		
		String hexPassword = hashService.computeHash(builder.setSource(ByteSource.Util.bytes(string)).build()).toString();
		return hexPassword;
	}

}
